package com.alibaba.csp.sentinel.dashboard.rule.nacos.flow;

import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.FlowRuleEntity;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.AbstractRuleNacosPublisher;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.SentinelNacosConstants;
import com.alibaba.csp.sentinel.dashboard.rule.nacos.SentinelNacosConvert;
import com.alibaba.csp.sentinel.util.AssertUtil;
import com.alibaba.nacos.api.config.ConfigService;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author marcher
 */
@Component("flowRuleNacosPublisher")
public class FlowRuleNacosPublisher extends AbstractRuleNacosPublisher<List<FlowRuleEntity>> {

    @Override
    public void publish(String app, List<FlowRuleEntity> rules) throws Exception {
        publishConfig(app, rules);
    }

    @Override
    protected String postfix() {
        return SentinelNacosConstants.FLOW_DATA_ID_POSTFIX;
    }
}
